from datetime import datetime
from typing import Optional, List

from pydantic import BaseModel

from app.schemas.base_model import OrmBaseModel


class StrategyCodeBase(OrmBaseModel):
    id: Optional[int]
    strategyId: Optional[int]
    code: Optional[str]
    params: Optional[str]
    version: Optional[int]
    precision: Optional[int]
    drawType: Optional[int]
    state: Optional[str]
    createdDate: Optional[datetime]
    updatedDate: Optional[datetime]


class StrategyCodeQuery(StrategyCodeBase):
    pass


class StrategyCodeSave(BaseModel):
    # id: Optional[int]
    strategyId: Optional[int]
    code: str
    params: str
    version: Optional[int]
    precision: int
    state: Optional[str]
    # createdDate: Optional[int]
    # updatedDate: Optional[int]

class StrategyCodeDetail(OrmBaseModel):
    id: Optional[int]
    strategyId: Optional[int]
    code: Optional[str]
    params: Optional[str]
    version: Optional[int]
    precision: Optional[int]
    drawType: Optional[int]
    state: Optional[str]
    createdDate: Optional[datetime]
    updatedDate: Optional[datetime]
    compiledVariables: Optional[List[str]]